var course = {
	first:true,
	classTypeId:""
	
};

//课程列表
course.list = function(){	
	openLoad();
    var args = getQueryStringArgs(),
    	courseGrade = args["courseGrade"],
    	classTypeId = args["classTypeId"],
    	courseName = args["courseName"],
    	campus = args["campus"];
		courseClass=args["courseClass"];
    	
	if(course.first){
		$("#aui-header-search").val(courseName);
	}
	else{
		courseName = $("#aui-header-search").val();
	}
	
	course.first = false;
		
		
    var options = {
    	courseName : courseName,
    	courseGrade:courseGrade,
    	classTypeId:classTypeId,
		courseClass: courseClass,
        courseStatus:"1",
        current:1,
        size:999
    };
    var ajax = new $ax(Feng.ctxPath+"/course/allParam", function(data){
    	Feng.log("课程信息查询成功");
    	var records = data.records || [];
    	if(records.length>0){
    		//图片过滤器
	        template.helper('pictureFormat', function (inp) {
	           if(inp){
	               return Feng.ctxPath+"/file/getImage/"+inp;
	           }
	           else{
	               return "themes/img/pd/course_defult.jpg";
	           }
	        });
	        //价格
	        template.helper('coursePriceFormat', function (inp) {
	            if(inp!==""){
	                return numeral(inp).format('0,0.00');
	            }
	        });
	        var outHtml = template("dataTmpl",records);
	        $(".aui-address-content").html(outHtml); 
    	}    
    	else{
    		tipSearchNull(".aui-address-content");
    	}
        closeLoad();
    },function(data){
    	closeLoad();
    	tipSearchNull(".aui-address-content");
        Feng.error("加载信息失败!");
    });
    ajax.setData(options);
    ajax.start();
};

$("#aui-header-search").keypress(function () {
    if (event.keyCode == 13) 	course.list();
});

$(function(){
	course.list();
	
	lazyloadImg();
});
